package com.df.ez_game.server;

/**
 * 服务节点基类
 */
public abstract class ServerNode {
    private String id;
    private String name;
    private NodeType type;

    /**
     * 节点启动方法
     */
    public abstract void start();

    /**
     * 节点停止方法
     */
    public abstract void stop();

    /**
     * 向BrokerManager注册节点
     */
    public abstract void registerToBrokerManager();

    /**
     * 发送心跳
     */
    public abstract void sendHeartbeat();
    public  void startAsync(){};

    // Getters and setters
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public NodeType getType() {
        return type;
    }

    public void setType(NodeType type) {
        this.type = type;
    }

    public  void shutDown() {
        throw new RuntimeException("未实现关闭方法:"+this.getClass().getName());
    }


}
